package reit.ass3;

import java.util.ArrayList;
import java.util.List;



/**
 * The Class RepairToolInformation.
 */
class RepairToolInformation {

	/** The m name. */
	private final String mName;

	/** The m tools. */
	private final List<RepairTool> mTools;

	/**
	 * Instantiates a new repair tool information.
	 *
	 * @param name the name
	 * @param list the list
	 */
	public RepairToolInformation(
			final String name,
			final List<reit.parser.repairinfo.AssetContentsRepairDetails.AssetContent.Tools.Tool> list) {
		this.mName = name;
		this.mTools = createRepairToolList(list);
	}

	/**
	 * Gets the name.
	 *
	 * @return the mName
	 */
	public String getName() {
		return mName;
	}

	/**
	 * Gets the tools.
	 *
	 * @return the mTools
	 */
	public List<RepairTool> getTools() {
		return mTools;
	}

	/**
	 * Creates the repair tool list.
	 *
	 * @param tools the tools
	 * @return the list
	 */
	private List<RepairTool> createRepairToolList(final List<reit.parser.repairinfo.AssetContentsRepairDetails.AssetContent.Tools.Tool> tools){
		List<RepairTool> result = new ArrayList<RepairTool>();
		for(reit.parser.repairinfo.AssetContentsRepairDetails.AssetContent.Tools.Tool t : tools){
			result.add(new RepairTool(t.getName(), t.getQuantity()));
		}
		return result;
	}

}
